import { ElMessage } from 'element-plus';

/**
 * Shows message content with external package feature.
 * [duration] is in second.
 */
export default class MessageService {
  static showSuccess(msg: string, duration: number = 3000): void {
    ElMessage({
      duration: duration,
      message: msg,
      type: 'success',
    });
  }

  static showError(msg: string, duration: number = 3000): void {
    ElMessage({
      duration: duration,
      message: msg,
      type: 'error',
    });
  }

  static showWarning(msg: string, duration: number = 3000): void {
    ElMessage({
      duration: duration,
      message: msg,
      type: 'warning',
    });
  }
}
